package com.et.launch

import android.app.Application
import android.content.Context
import android.os.Environment
import com.et.logger.ELog
import com.et.logger.TAGS
import com.tencent.bugly.crashreport.CrashReport

class App : Application() {

    override fun onCreate() {
        super.onCreate()
        application = applicationContext
        Environment.getExternalStoragePublicDirectory("log").apply {
            if (!exists()) mkdirs()
            if (exists()) {
                ELog.init(this)
            }
        }
        ELog.d(TAGS.launch, "launch:application onCreate")
        CrashReport.initCrashReport(applicationContext, "10e0a8d445", false)
        AppCrashHandler.register()
    }

    companion object {
        lateinit var application: Context
    }
}